using System;
using System.Collections;
using System.IO;

public class PluginsManager
{
	private static ArrayList pluginsInstalled=null;

	public PluginsManager() {

		// Check if is the first time that this istance is build
		if (pluginsInstalled==null) {
			pluginsInstalled=new ArrayList();

			// Create an instance of plugins game player
			ComputerGamersInterface gi=new ComputerGamers1();
			pluginsInstalled.Add(gi);

			gi=new ComputerGamersPerfect();
			pluginsInstalled.Add(gi);
		}
	}

	static public string getPluginsDescription(int i) {
		if (i<pluginsInstalled.Count && i>=0) {
			ComputerGamersInterface gi=(ComputerGamersInterface)pluginsInstalled[i];
			return gi.getComputerGamerDescription();
		}
		return "";
	}

	static public string getPluginsDefaultNamePlayer(int i) {
		if (i<pluginsInstalled.Count && i>=0) {
			ComputerGamersInterface gi=(ComputerGamersInterface)pluginsInstalled[i];
			return gi.getComputerGamerDefaultNamePlayer();
		}
		return "";
	}

	static public ComputerGamersInterface createNewInstance(int i) {
		if (i<pluginsInstalled.Count && i>=0) {
			ComputerGamersInterface gi=(ComputerGamersInterface)pluginsInstalled[i];
			return (ComputerGamersInterface)Activator.CreateInstance(gi.GetType());
		}
		return null;
	}

	static public string getComputerGamesClassName(int i) {
		if (i<pluginsInstalled.Count && i>=0) {
			ComputerGamersInterface gi=(ComputerGamersInterface)pluginsInstalled[i];
			return gi.GetType().ToString();
		}
		return "";
	}

	static public int numberOfPlugin() {
		if (pluginsInstalled!=null) {
			return pluginsInstalled.Count;
		}
		return 0;
	}

}